<template>
  <svg :class="svgClass" aria-hidden="true" :width="size" :height="size" @click="$emit('click')">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script>
export default {
  name: 'SvgIcon',

  props: {
    iconClass: {
      type: String,
      required: true
    },

    className: {
      type: String,
      default: ''
    },

    size: {
      type: String,
      default: '16'
    }
  },

  computed: {
    iconName() {
      return `#icon-${this.iconClass}`;
    },

    svgClass() {
      if (this.className) {
        return 'svg-icon ' + this.className;
      } else {
        return 'svg-icon';
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.svg-icon {
  @include fill('fontColor4');
  overflow: hidden;
}
</style>
